package com.lagou.tomcat;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

import javax.servlet.ServletException;

/**
 * @Author: Tao Zheng
 * @classNmae: SpringApplication
 * @packageName: com.lagou.web
 * @description:
 * @DATE: 2021/7/9 16:55
 */
public class MySpringApplication {

    public static void run(String[] args) {
        try{
            Tomcat tomcat = new Tomcat();
            tomcat.setPort(8000);
            tomcat.addWebapp("/", "E:\\");
            tomcat.start();
            // 异步进行接收请求，阻塞式。否则方法执行完会直接结束
            tomcat.getServer().await();
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (LifecycleException e) {
            e.printStackTrace();
        }

    }
}
